<!DOCTYPE html>
<html>
    <head>
<meta name="Generator" content="ECSHOP v2.7.3" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta charset="utf-8">
        <title>纯乐自造 - 完善信息</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="format-detection" content="telephone=no">
        <link href="themes/default/ectouch.css" rel="stylesheet" type="text/css">
        <link href="themes/default/sweet-alert.css" rel="stylesheet" type="text/css">
		
		<?php echo $this->smarty_insert_scripts(array('files'=>'jquery-1.7.2.min.js,sweet-alert.min.js,transport.js,region.js')); ?>
    </head>
    <body>
    	<img src="/themes/default/logo.png" width="50%" style="position:relative;top:-10px" />
        <div id="tbh5v0" style="position:relative;top:-85px">
            <div class="login">
                <div class="blank3">
                </div>
                <section class="wrap">
                        <section class="order_box padd1" style="padding-top:0;padding-bottom:0;">
                        
                            <div class="table_box table_box2">
                                <dl>
                                    <dd class="dd1">
                                        真实姓名
                                    </dd>
                                    <input placeholder="您的真实姓名" name="user_name" id="user_name" type="text" class="dd2" value="<?php echo $this->_var['info']['user_name']; ?>">
                                </dl>
                                <dl>
                                    <dd class="dd1">
                                        手机号码
                                    </dd>
                                    <input placeholder="您的手机号" name="mobile_phone" id="mobile_phone" type="text" class="dd2" value="<?php echo $this->_var['info']['mobile_phone']; ?>">
                                </dl>
                                <dl>
                                    <dd class="dd1">
                                        验证码
                                    </dd>
                                    <div class="dd2">
                                        <input placeholder="" name="code" id="code" type="text" class="dd2" value="" style="width:30%"><a class="c-btn3 button-fir-active" style="width:50%;float:right" href="javascript:sendMsg()" id="msg">发送验证码</a>
                                    </div>
                                </dl>
                                <dl>
                                    <dd class="dd1">
                                        性别
                                    </dd>
                                    <select name="sex" class="dd2">
                                      
                                        <option <?php if ($this->_var['info']['sex'] == 1): ?>selected="selected"<?php endif; ?> value="1">男</option>
                                        <option <?php if ($this->_var['info']['sex'] == 2): ?>selected="selected"<?php endif; ?> value="2">女</option>
                                    </select>
                                </dl>
                                <dl>
                                    <dd class="dd1">
                                    	出生年月
                                    </dd>
                                    <select id="year" name="year" style="width:35%" class="dd2">
                                    	<?php $_from = $this->_var['yearArr']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'i');if (count($_from)):
    foreach ($_from AS $this->_var['i']):
?>
                                        	<option <?php if ($this->_var['year'] == $this->_var['i']): ?>selected="selected"<?php endif; ?> value="<?php echo $this->_var['i']; ?>"><?php echo $this->_var['i']; ?></option>
										<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                                    </select>
                                    <select id="month" name="month" style="width:30%" class="dd2">
                                    	<?php $_from = $this->_var['monthArr']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'i');if (count($_from)):
    foreach ($_from AS $this->_var['i']):
?>
                                        	<option <?php if ($this->_var['month'] == $this->_var['i']): ?>selected="selected"<?php endif; ?> value="<?php echo $this->_var['i']; ?>"><?php echo $this->_var['i']; ?></option>
										<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                                    </select>
                                    <select id="day" name="day" style="width:30%" class="dd2">
                                    	<?php $_from = $this->_var['dayArr']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'i');if (count($_from)):
    foreach ($_from AS $this->_var['i']):
?>
                                        	<option <?php if ($this->_var['day'] == $this->_var['i']): ?>selected="selected"<?php endif; ?> value="<?php echo $this->_var['i']; ?>"><?php echo $this->_var['i']; ?></option>
										<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                                    </select>
                                </dl>
								
					<dl>
                                    <dd class="dd1">
                                    	邮寄地址
                                    </dd>				
								<select name="province" id="selProvinces" onchange="region.changed(this, 2, 'selCities')" style="width:35%" class="dd2"  >
                      <option value="0">省份</option>
                      <?php $_from = $this->_var['province_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'province');if (count($_from)):
    foreach ($_from AS $this->_var['province']):
?>
                      <option value="<?php echo $this->_var['province']['region_id']; ?>" <?php if ($this->_var['info']['province'] == $this->_var['province']['region_id']): ?>selected<?php endif; ?>><?php echo $this->_var['province']['region_name']; ?></option>
                      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                    </select>
                    <select name="city" id="selCities" onchange="region.changed(this, 3, 'selDistricts')"  style="width:30%" class="dd2"  >
                      <option value="0">城市</option>
                      <?php $_from = $this->_var['city_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'city');if (count($_from)):
    foreach ($_from AS $this->_var['city']):
?>
                      <option value="<?php echo $this->_var['city']['region_id']; ?>" <?php if ($this->_var['info']['city'] == $this->_var['city']['region_id']): ?>selected<?php endif; ?>><?php echo $this->_var['city']['region_name']; ?></option>
                      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                    </select>
                    <select name="district" id="selDistricts"  style="width:30%" class="dd2"  >
                      <option value="0">地区</option>
                      <?php $_from = $this->_var['district_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'district');if (count($_from)):
    foreach ($_from AS $this->_var['district']):
?>
                      <option value="<?php echo $this->_var['district']['region_id']; ?>" <?php if ($this->_var['info']['district'] == $this->_var['district']['region_id']): ?>selected<?php endif; ?>><?php echo $this->_var['district']['region_name']; ?></option>
                      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                    </select>
					</dl>
					
					<dl>
                                    <dd class="dd1">
                                    	
                                    </dd>
									
                                        <input placeholder="您的详细地址" class="dd2" name="address" id="address" type="text"  value="<?php echo $this->_var['info']['address']; ?>" >
                                   
					</dl>				
                            </div>
                        </section>
                        <div class="blank3">
                        </div>
                        <input name="openid" id="openid" type="hidden" value="<?php echo $this->_var['openid']; ?>">
                        <?php if ($this->_var['info']['mobile_phone'] && $this->_var['info']['user_name']): ?>
                         <input name="save" onclick="javascript:history.back(-1);" type="button" value="返回" class="c-btn3 button-fir-active" style="width:48%;float:left;margin-right:4%">
                         <input name="save" onclick="save()" type="button" value="确认" class="c-btn3 button-fir-active" style="width:48%;float:left">
                        <?php else: ?>
                        <input name="save" onclick="save()" type="button" value="确认" class="c-btn3 button-fir-active">
                    	<?php endif; ?>
                    <div class="blank3">
                    </div>
                </section>
            </div>
        </div>
        <script>
        	
			delete(Object.prototype.toJSONString);
			
        	function save(){
				
				var user_name = $("#user_name").val();
				var code = $("#code").val();
				var phone = $("#mobile_phone").val();
				var city = $("#selCities").val();
				var province = $("#selProvinces").val();
				var district = $("#selDistricts").val();
			
				var address = $("#address").val();
				var year = $("#year").val();
				var month = $("#month").val();
				var day = $("#day").val();
				var openid = $("#openid").val();
				if(!user_name||!province||!city||!district||!address){
					 swal("请填写完整信息");
	             	 return false;
				}
//				if(!code){
//					 swal("请填写验证码");
//	             	 return false;
//				}
				if(!phone){
					 swal("请填写手机号码");
	             	 return false;
				}
				var url = "info.php?act=save";
				var date = {
					user_name:user_name,
					code:code,
					mobile_phone:phone,
					year:year,
					month:month,
					day:day,
					wxid:openid,
					address:address,
					province:province,
					city:city,
					district:district
					
				}
				$.post(url,date,function(res){
					if(res.error==0){
						swal(res.content);
						setTimeout("window.location.href='info.php?act=user&openid=<?php echo $this->_var['openid']; ?>'", 1000);
					}else{
						swal(res.content);
					}
				},"json");
				
				
			}
            var count = 120;
//            function userEdit(){
//				
//				console.info(user_name || code || phone);
//				if(user_name){
//					if(phone){
//						if(code){
//							
//							
//							return true;
//						}
//					}
//					
//				}
//				
//            }
            var sh;
			
			var msg =  document.getElementById("msg");
			
            function sendMsg(){
                if (count == 120) {
					var phone = $("#mobile_phone").val();
					var url ="info.php?act=send";
					var openid= '<?php echo $this->_var['openid']; ?>';
					var date = {
						tel:phone,
						wxid:openid
					}			
					$.post(url,date,function(res){
						if(res.error==1){
							swal(res.content);
						}else{
		                    $(msg).css({
		                        background: "silver"
		                    });
		                    sh = setInterval("show()", 1000);
						}
					},"json")
                }
            }
//			msg.style.backgroundColor = "#EA5506";
            
            function show(){
                var message = count + "秒后可重发";
                msg.innerHTML = message;
                count--;
                if (count < 0) {
                    $(msg).css({
                        background: "#EA5506"
                    });
					
					msg.innerHTML = "发送验证码";
                    //$msg.html("发送验证码");
                    clearInterval(sh);
                    count = 120;
                }
                
            }
        </script>
    </body>
</html>
